# modules/squid/manifests/init.pp - manage squid stuff
# Copyright (C) 2007 admin@immerda.ch
#

# modules_dir { "at3_nfs": }

import "nfs"
import "crvpuppet"


define at3_nfsclient($webaddr="", $roleid="") {
  if $AutoMode==true and $CloudCRV==true {
    $NFSServerAddr=get_provider_attr($webaddr,$roleid,"NFSServerAddr")
    $NFSServerClientMountPath=get_provider_attr($webaddr,$roleid,"NFSServerClientMountPath")
  }
  
  if ( $AutoMode == false ) or ( $AutoMode==true and $CloudCRV==true ) {
    include nfs_client
    notice("Setting up NFS Share: '$NFSServerAddr' to '$NFSServerClientMountPath'")
    mount_nfs_share { $NFSServerClientMountPath:
      source => $NFSServerAddr, 
    }
  }
  
  if $AutoMode==true and $CloudCRV==true {
    set_role_attr($webaddr,$roleid,"NFSClientAddr",$ipaddress)

    #copy NFSServerClientMountPath to this client so dependent roles will know where to access
    set_role_attr($webaddr,$roleid,"NFSServerClientMount","$NFSServerClientMountPath")
    #set_role_attr($webaddr,$roleid,"ProfileApplied","True")
  }
}



define at3_nfsclient_reverse($webaddr, $roleid) {
  set_role_attr($webaddr,$roleid,"NFSClientAddr","")

  #set_role_attr($webaddr,$roleid,"ReverseProfileApplied","True")
}
